package com.clp.util.hutool;

import com.clp.util.hutool.core.lang.ConsoleTable;
import com.clp.util.hutool.core.util.ClassUtil;
import com.clp.util.hutool.core.util.StrUtil;

import java.lang.reflect.Type;
import java.util.Set;

public class Hutool {
    public static final String AUTHOR = "Looly";

    private Hutool() {}

    public static Set<Class<?>> getAllUtils() {
        return ClassUtil.scanPackage("com.clp.util.hutool",
                clazz -> (!clazz.isInterface() && StrUtil.endWith(clazz.getSimpleName(), "Util")));
    }

    public static void printAllUtils() {
        final Set<Class<?>> allUtils = getAllUtils();
        final ConsoleTable consoleTable = ConsoleTable.create().addHeader("工具类名", "所在包");
        for (Class<?> clazz : allUtils) {
            consoleTable.addBody(clazz.getSimpleName(), clazz.getPackage().getName());
        }
        consoleTable.print();
    }
}
